     <include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('Ht/index')}">列表</a></li>
        <li><a href="{:url('Ht/add')}">添加</a></li>
    </ul>
    <form class=" well form-inline margin-top-20" method="get" id="ljz-form-search">
        姓名:
        <input type="text" class="form-control" name="key_name" style="width:150px;"
               value="" placeholder="">

        <button class="btn btn-primary" id="bt_search">搜索</button>
        <button class="btn btn-primary" id="bt_output">导出</button>
        <a class="btn btn-danger" href="{:url('Ht/index')}">清空</a>
    </form>
    <table class="table table-hover table-bordered">
        <thead>
        <tr>
            <th>合同编号</th>
            <th>归属类型</th>
            <th>合同名称</th>
            <th>客户名称</th>
<!--            <th>牌号</th>-->
<!--            <th>厚</th>-->
<!--            <th>宽</th>-->
<!--            <th>长</th>-->
            <th>重量</th>
            <th>张数</th>
            <th>交货时间</th>
            <th>图片附件</th>
            <th>文件附件</th>
            <th>备注</th>
            <th>添加时间</th>
            <th>更新时间</th>
            <th>最后操作人</th>
            <th width="150">操作</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="lists['data']" item="vo">
            <tr>
                <td>
                    {$vo['ht_number']}
                </td>
                <td>{$companytypea_arr[$vo['companytype']]|default=''}</td>
                <td>
                    {$vo['ht_name']}
                </td>
                <td>
                    {$company_id_arr[$vo['company_id']]|default=''}
                </td>
<!--                <td>-->
<!--                    {$grade_id_arr[$vo['ht_grade_id']]|default=''}-->
<!--                </td>-->
<!--                <td>-->
<!--                    {$vo['ht_d']}-->
<!--                </td>-->
<!--                <td>-->
<!--                    {$vo['ht_w']}-->
<!--                </td>-->
<!--                <td>-->
<!--                    {$vo['ht_h']}-->
<!--                </td>-->
                <td>
                    {$vo['ht_tw']}
                </td>
                <td>
                    {$vo['ht_sheets']}
                </td>
                <td>
                    {:date('Y-m-d H:i',$vo['delivery_time'])}
                </td>
                <td>
                    <button onclick="detail({$vo.id},'image_enclosure')" type="button" class="btn btn-info">查看</button>                </td>
                <td>
                    <button onclick="detail({$vo.id},'file_enclosure')" type="button" class="btn btn-info">查看</button>
                <td>
                    {$vo['remark']}
                </td>

                <td>
                    {:date('Y-m-d H:i',$vo['add_time'])}
                </td>
                <td>
                    {:date('Y-m-d H:i',$vo['update_time'])}
                </td>
                <td>
                    {$user_arr[$vo['admin_id']]|default=''}
                </td>
                <td>
                    <a class="btn btn-xs btn-primary" href="{:url('Ht/edit',['id'=>$vo['id']])}">编辑</a>
                    <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('Ht/del',['id'=>$vo['id']])}">删除</a>
                </td>
            </tr>
        </foreach>
        </tbody>
    </table>
    <div class="pagination">{$page}</div>
</div>
<script src="/static/js/admin.js"></script>
<script src="/static/js/layer/layer.js"></script>
<script>
    function see(obj) {
        layer.open({
            content: $(obj).text().trim()
        });
    }
    $(function () {
        // 条件查询
        $("#bt_search").click(function(){
            $("#ljz-form-search").removeAttr('action');
            $("#ljz-form-search").attr('action',"{:url('Ht/index')}" );
            $("#ljz-form-search").submit();
        });
        // 数据导出成excel表格
        $("#bt_output").click(function(){
            $("#ljz-form-search").removeAttr('action');
            $("#ljz-form-search").attr('action',"{:url('Ht/outexcel')}");
            $("#ljz-form-search").submit();
        });
    });
    function detail(id, field) {
        $.ajax({
            url: '{:url("Ht/field")}?id=' + id + '&field=' + field,
            type
    :
        'get',
            success(res)
        {
            if (res.code == 1) {
                let tpl = '';
                for (const item of res.data) {
                    tpl += `<p>地址：<input value="${item.filename}" readonly class="form-control" style="width:80%;display: inline-block;" type="text">&nbsp;<a target="_blank" href="{$domain}${item.file_path}" class="btn btn-success">跳转</a></p>`;
                }
                layer.open({
                    area: ['60%', '100%'],
                    content: tpl
                });
            } else {
                layer.msg('查看失败');
            }
        }
    })
        ;
    }
</script>
</body>
</html>
</body>
</html>
